using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.CodeRush.StructuralParser;
using DevExpress.CodeRush.Core;

namespace DX_SourceOutliner
{
    public abstract class NameProcessorBase : INodeProcessor
    {
        protected ISourceTreeNode _source;

        public TreeNode Process(TreeNode node)
        {
            _source = (ISourceTreeNode)node.Tag;

            if ((_source.Element as MemberWithParameters) != null && !string.IsNullOrEmpty(_source.ParamterText))
                SetElementTextWithParameters(node);
            else
                SetElementTextWithoutParameters(node);

            return node;
        }

        protected virtual void SetElementTextWithoutParameters(TreeNode node)
        {
            node.Text = _source.ElementName;
        }

        protected abstract void SetElementTextWithParameters(TreeNode node);

    }
}